package com.amc.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.amc.dao.IOrderDao;
import com.amc.dto.ComplaintView;
import com.amc.dto.FoodView;
import com.amc.dto.OrderView;
import com.amc.service.IOrderService;
import com.amc.utils.ComplaintCommit;

@Transactional
@Service(value="orderService")
public class OrderServiceImpl implements IOrderService {
	private IOrderDao dao;
	@Resource
	public void setDao(IOrderDao dao) {
		this.dao = dao;
	}
	
	@Override
	public boolean placeOrder(OrderView order) {
		return dao.placeOrder(order);
	}

	@Override
	@Transactional
	public List<OrderView> queryAllOrder(String customerId) {
		return dao.queryAllOrder(customerId);
	}

	@Override
	@Transactional
	public OrderView queryOrderById(String orderId) {
		return dao.queryOrderById(orderId);
	}

	@Override
	@Transactional
	public boolean receiptOrder(String orderId) {
		return dao.receiptOrder(orderId);
	}

	@Override
	@Transactional
	public boolean cancellOrder(String orderId) {
		return dao.cancellOrder(orderId);
	}

	@Override
	@Transactional
	public boolean complaintMerchant(ComplaintView complaint) {
		ComplaintCommit cc=new ComplaintCommit();
		cc.complaintCommit(complaint);
		return dao.complaintMerchant(complaint);
	}

	@Override
	@Transactional
	public FoodView queryFood(String foodId) {
		return dao.queryFood(foodId);
	}

	@Override
	public boolean refuseOrder(String orderId) {
		return dao.refuseOrder(orderId);
	}
}
